package com.code;

public class AnimalTest3 {

	public static void main(String[] args) {
		Animal animal = new Person1();
		animal.eat();
		System.out.println(animal.a);
		
		animal = new Pig();
		animal.eat();
		System.out.println(animal.a);
		
		if (animal instanceof Person1) {
			Person1 person = (Person1)animal;
			person.playBird();
		} else if (animal instanceof Pig) {
			Pig person = (Pig)animal;
			person.gongBaiCai();
		}
		
		
	}

}
